<?php 
include	'config.php';
include_once ROOT_PATH.'library/cls-common.php';
$getColId = $sr->request('colid','int','get');
$subid = $sr->request('subid','int','get');
$getId = $sr->request('id','int','get');
/*
* 获取子栏目id
*/
function getTrueColumnId($colid,$db){
	$sql = 'select id from blog_column where parent_id = '.$colid.' order by range_num,id';
	$rsCol = $db->query($sql);
	
	if($dbo->resultNum>0){
		//存在下級項目時的處理過程
		$tmp = getTrueColumnId($rsCol[0]['id'],$db);
	}else{
		$tmp = $colid;
	}
	return $tmp;
}
$column_id	=	getTrueColumnId($getColId,$dbo);
/**
*	获取当前栏目信息
*
**/
$sql	=	'select id,column_name,parent_id,is_list,patch from `blog_column` where id='.$column_id;
$rs		=	$dbo->query($sql);
if($dbo->resultNum==0){
	$errmsg	='栏目下无信息';	
}else{
		$column_id = $rs[0]['id'];
		$path = $rs[0]['patch'];
		$ColumnIsList =  $rs[0]['is_list'];
		$ColumnName = $rs[0]['column_name'];
}
if($ColumnIsList>0){
	$ShowList=true;	
}
if($getId>0){
	$ShowList=false;	
	//阅读增加一次
	$dbo->addUp('hit','blog_article','id = '.$getId.'');
	$rsinfo	=	$dbo->getOneRecord('is_show = 1 and id = '.$getId.'','blog_article','title,content');
	$title	=	$rsinfo['title'];
	$content=	$rsinfo['content'];
	
}

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>亨得利blog</title>
<link href="style/public.css" rel="stylesheet" type="text/css" />
<link href="theme/default/style.css" rel="stylesheet" type="text/css" />
<script language="javascript" type="text/javascript" src="javascript/jquery-1.4.2.min.js"></script>
<script language="javascript" type="text/javascript" src="javascript/jquery.nyroModal-1.6.2.min.js"></script>
<script language="javascript" type="text/javascript" src="javascript/jquery.form.js"></script>
<script language="javascript" type="text/javascript" src="javascript/public.js"></script>
<script language="javascript" type="text/javascript" src="javascript/loginajax.js"></script>
<script language="javascript" type="text/javascript">
<!--
$(function(){
	$('.Button').hover(function(){
			$(this).addClass('ButtonOver');
		},function(){
			$(this).removeClass('ButtonOver');	
		});
	
});
//-->
function del(){
	if(confirm("你是否确定删除此文章！！")){
		return true;		
	}else{
		return false;
	}
}
</script>
</head>

<body>
<?php
	include	'panel-head.php';
?>
	<div id="PanelLeft">
		<div id="BlogerInfo" class="LeftBox FrameBox">
			<h3 class="BoxTitle">个人资料</h3>
			<div class="BoxContent">
				<div class="HeadImageBig"><img src="upload/member-headimage/001.jpg" alt="" /></div>
				
		 </div>
		</div>
		<div class="LeftBox FrameBox">
	  <h3 class="BoxTitle">文章分类</h3>
			<div class="BoxContent">
				<ul class="TitleList">
                <?php
                $sql	=	'select id,column_name from `blog_column` where is_show=1 order by range_num desc,id asc';
				$rs_col	=	$dbo->query($sql);
				$num	=	$dbo->resultNum;
				for($i=0;$i<$num;$i++){
					echo '<li><a href="article.php?colid='.$rs_col[$i]['id'].'">'.$rs_col[$i]['column_name'].'</a></li>';
				}
				
				?>
				</ul>
			</div>
		</div>
	</div>
	<div id="PanelBody">
	 <div class="FrameBox">
	  <h3 class="BoxTitle">文章<?php if(!empty($_SESSION['User'])){	echo '|-----<a href="article-edit.php">发布文章</a>';}?></h3>
      <div class="BoxContent">
			<?php
			if(empty($errmsg)){
            	if($ShowList){
					include 'inc-article-list.php';
				}else{
					echo $content;
				}
			}else{
				echo $errmsg;	
			}
			?>
           </div>
	 </div>
</div>
	<?php
    	include 'panel-foot.php';
	?>
</div>
</body>
</html>